Проблема с вызовом repr других объектов в своём собственном методе repr заключается в том, что нельзя гарантировать, что ни один из других объектов не равен self, и вызов не окажется рекурсивным:
In : p = Pair(1, 2) In : p Out: Pair(1, 2) In : p.right = p In : p Out: [...] RecursionError: maximum recursion depth exceeded while calling a Python object
Чтобы просто решить эту проблему, можно использовать декоратор reprlib.recursive_repr:
Проблема с вызовом repr других объектов в своём собственном методе repr заключается в том, что нельзя гарантировать, что ни один из других объектов не равен self, и вызов не окажется рекурсивным:
In : p = Pair(1, 2) In : p Out: Pair(1, 2) In : p.right = p In : p Out: [...] RecursionError: maximum recursion depth exceeded while calling a Python object
Чтобы просто решить эту проблему, можно использовать декоратор reprlib.recursive_repr:
A leaked Telegram discussion by 50 so-called crypto influencers has exposed the extraordinary steps they take in order to profit on the back off unsuspecting defi investors. According to a leaked screenshot of the chat, an elaborate plan to defraud defi investors using the worthless “$Few” tokens had been hatched. $Few tokens would be airdropped to some of the influencers who in turn promoted these to unsuspecting followers on Twitter.
The S&P 500 slumped 1.8% on Monday and Tuesday, thanks to China Evergrande, the Chinese property company that looks like it is ready to default on its more-than $300 billion in debt. Cries of the next Lehman Brothers—or maybe the next Silverado?—echoed through the canyons of Wall Street as investors prepared for the worst.